﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
    xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>
        Add Outlook Contact
      </Title>
    </Header>
    <Snippet>
      <Code Language="CSharp">
        <![CDATA[
		private void AddContact()
		{
			Outlook.ContactItem newContact = (Outlook.ContactItem)
				this.CreateItem(Outlook.OlItemType.olContactItem);
			try
			{
				newContact.FirstName = "Jo";
				newContact.LastName = "Berry";
				newContact.Email1Address = "somebody@example.com";
				newContact.CustomerID = "123456";
				newContact.PrimaryTelephoneNumber = "(425)555-0111";
				newContact.MailingAddressStreet = "123 Main St.";
				newContact.MailingAddressCity = "Redmond";
				newContact.MailingAddressState = "WA";
				newContact.Save();
				newContact.Display(true);
			}
			catch 
			{
				MessageBox.Show("The new contact was not saved.");
			}
		}
		]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>